<template>
    <div class="movie-detail-page">
      <div class="movie-detail">
        <div class="movie-name">{{ detail.name }}</div>
        <div class="detail-container">
          <div class="cover">
            <img :src="detail.cover" alt="">
          </div>
          <ul class="info">
            <li>导演：<span>{{ detail.director }}</span></li>
            <li>编剧：<span>{{ detail.author }}</span></li>
            <li>主演：<span>{{ detail.actors }}</span></li>
            <li>类型：<span>{{ detail.type }}</span></li>
            <li>制片国家/地区：<span>{{ detail.country }}</span></li>
            <li>语言：<span>{{ detail.language }}</span></li>
            <li>上映日期：<span>{{ detail.birth }}</span></li>
            <li>片长：<span>{{ detail.long }}</span></li>
            <li>又名：<span>{{ detail.nickName }}</span></li>
          </ul>
          <div class="rank-container">
            <div class="title">评分</div>
            <div class="current-rank">
              <div class="rank">8.1</div>
              <div class="rank-star">
                <el-rate :value="detail.rank" disabled></el-rate>
                <div class="rank-number">{{ detail.rankNumber }}人评价</div>
              </div>
            </div>
          </div>
        </div>
        <div style="margin-bottom: 10px;">我的评价</div>
        <el-rate v-model="rank" show-text></el-rate>
      </div>
      <div class="ad-container">
        请 投<br>
        喂 我<br>
        广 告<br>
      </div>
    </div>
</template>
<script>
export default {
  name: 'movie-detail',
  data: () => {
    return {
      detail: {},
      rank: 0
    }
  },
  methods: {
    async getDetail () {
      const res = await this.$store.dispatch('movie/GET_MOVIE_DETAIL', {
        id: Number(this.$route.params.id)
      })
      console.log(res)
      this.detail = { ...res.data, rank: (res.data.rank / 2) }
    }
  },
  mounted () {
  },
  created () {
    this.getDetail()
  }
}
</script>
<style scoped>
.movie-detail-page {
  position: relative;
  font-size: 13px;
}
.movie-detail {
  width: 700px;
}
.movie-name {
  font-size: 26px;
  color: #494949;
  line-height: 1.1;
  font-weight: bold;
  margin-bottom: 15px;
}
.detail-container {
  overflow: hidden;
  width: 100%;
}
.detail-container .cover {
  float: left;
  width: 135px;
  padding-right: 15px;
}
.detail-container .cover img{
  width: 135px;
}
.detail-container .info {
  float: left;
  width: 320px;
  color: #666;
  line-height: 2;
  margin-top: -6px;
}
.detail-container .info li span {
  color: #111;
}
.detail-container .rank-container {
  float: right;
  width: 170px;
  border-left: 1px solid #eaeaea;
  padding-left: 15px;
}
.detail-container .rank-container .title {
  color: #9b9b9b;
  margin-bottom: 10px;
}
.rank-container .current-rank {
  display: table;
  font-size: 12px;
}
.rank-container .current-rank .rank {
  color: #494949;
  width: 60px;
  font-size: 28px;
  display: table-cell;
  vertical-align: middle;
}
.rank-container .current-rank .rank-star {
  color: #494949;
  width: 110px;
  display: table-cell;
  vertical-align: middle;
}
.rank-container .current-rank .rank-number {
  color: #666699;
}
.rank-container .current-rank .rank-star /deep/ .el-rate__icon {
  margin-right: 3px;
}
.ad-container {
  width: 300px;
  background: #258dcd;
  position: absolute;
  top: 0;
  right: 0;
  color: #f0f3f5;
  font-weight: 700;
  font-size: 50px;
  text-align: center;
  padding: 30px 0;
  line-height: 80px;
  word-spacing: 10px;
}
</style>
